package com.gylang.common;

import com.gylang.common.constant.CommonConstant;
import org.joda.time.DateTimeUtils;

import java.util.concurrent.TimeUnit;

/**
 * @author gylang
 * @date 2021/1/3
 */
public class DateUtils extends DateTimeUtils {


    public static long currentTimeSecond() {
        return TimeUnit.MILLISECONDS.toSeconds(currentTimeMillis());
    }

    /**
     * 如果过期时间大于当前时间戳 或者
     * @param expire
     * @return
     */
    public static boolean gtCurrentTimeOrEver(Long expire) {
        return null != expire
                && (expire.equals(CommonConstant.EVER_TIME) || DateUtils.currentTimeSecond() < expire);
    }
}
